/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package services;

import java.util.ArrayList;
import ve.usb.Composer.Algoritmos.Algoritmo;
import ve.usb.Names;
import ve.usb.Runner.RunnerAll;


/**
 *
 * @author ari
 */
public class CallComposer {

    public boolean runUSBcomposer(String query, String services) {
        try {
            
            ve.usb.MyKB myKb;
            ArrayList<Algoritmo> algos = new ArrayList<Algoritmo>();

            String urlBase = "http://www.ldc.usb.ve/~rangarita";
            String serviceName = "Ontologies/Graphs/Transac/Escenario1/BA800_3_4/MyServices.owl";
            String razonador = "Pellet";
            
            System.out.println("Usando: " + urlBase + " " + serviceName + " " + razonador);

            //Aqui hay que obtener el myKb
            
            Names.setNames(urlBase + "/" + serviceName);
            myKb = new ve.usb.MyKB(urlBase, serviceName);
            myKb.load();
            myKb.classify(razonador);

            //Aqui hay que ver como crear todos los algoritmos
            algos.add(new ve.usb.Composer.Algoritmos.Sam("Sam"));
            algos.add(new ve.usb.Composer.Algoritmos.SamFlorescu("SamFlorescu"));
            algos.add(new ve.usb.Composer.Algoritmos.SamUnfolding("SamUnfolding"));
            algos.add(new ve.usb.Composer.Algoritmos.SamExhaustFirst("SamExhaust"));

            //Aqui hay que sacar los queries

            RunnerAll runner = new RunnerAll(algos);

            System.gc();

            runner.setQueries(myKb.getQueries());
            runner.setServices(myKb.getServices());
            runner.setKb(myKb);

            runner.run();
            
            return true;
        } catch (Exception e) {
            return false;
        }
    }    
    
    public boolean runFrenchcomposer(String query, String services) {
        return true;
    }
    
}
